/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 17655
 * Date: 2024-12-24
 * Time: 11:12
 */
public class test1 {
    /*
    LeetCode 27 移除元素
     */
    public int removeElement(int[] nums, int val) {
        int left = 0;
        int right = nums.length;
        while(left<right){
            if(nums[left]==val){
                nums[left]=nums[right-1];
                right--;
            }else{
                left++;
            }
        }
        return left;
    }
}
